home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / em-xmkit.zip / EMM15_C.ASM < prev    next >
Assembly Source File  |  1989-11-29  |  6KB  |  111 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM15_C.ASM                                             ;
  3. ;                                                                             ;
  4. ;    FUNCTION NAME:   get_set_context                                         ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function simultaneously saves a current mapping    ;
  7. ;                     context and restores a previous mapping context for all ;
  8. ;                     mappable memory regions (both conventional and          ;
  9. ;                     expanded).  First, it copies the contents of the        ;
  10. ;                     mapping hardware from each expanded memory board into a ;
  11. ;                     destination structure.  (The application must pass a    ;
  12. ;                     pointer to the destination structure.)  Then the        ;
  13. ;                     function copies the contents of a source structure      ;
  14. ;                     into the mapping hardware on each of the expanded       ;
  15. ;                     memory boards.  (The application must pass a pointer to ;
  16. ;                     the source structure.)                                  ;
  17. ;                                                                             ;
  18. ;                     Use this function instead of save_context &             ;
  19. ;                     restore_context if you need to save or restore the      ;
  20. ;                     mapping context but don't want (or have) to use a       ;
  21. ;                     handle.                                                 ;
  22. ;                                                                             ;
  23. ;           PASSED:   &dest_context:                                          ;
  24. ;                        is a far pointer to the destination structure of the ;
  25. ;                        mapping context to be saved.                         ;
  26. ;                                                                             ;
  27. ;                     &source_context:                                        ;
  28. ;                        is a far pointer to the source structure of the      ;
  29. ;                        mapping context to be restored.                      ;
  30. ;                        The structure member is described here:              ;
  31. ;                                                                             ;
  32. ;                        source_context.reserved:                             ;
  33. ;                           is a character array which is reserved for use by ;
  34. ;                           the memory manager.  In this instance it contains ;
  35. ;                           the data for the mapping hardware state.          ;
  36. ;                                                                             ;
  37. ;         RETURNED:   status:                                                 ;
  38. ;                        is the status EMM returns from the call.  All other  ;
  39. ;                        returned results are valid only if the status        ;
  40. ;                        returned is zero.  Otherwise they are undefined.     ;
  41. ;                                                                             ;
  42. ;                     dest_context:                                           ;
  43. ;                        is a structure containing the state of all the       ;
  44. ;                        mapping hardware on all boards in the system.  It    ;
  45. ;                        also contains any additional information necessary   ;
  46. ;                        to restore the boards to their original state when   ;
  47. ;                        the program invokes a set_context or get_set_context ;
  48. ;                        function.                                            ;
  49. ;                        The structure member is described here:              ;
  50. ;                                                                             ;
  51. ;                        dest_context.reserved:                               ;
  52. ;                           is a character array which is reserved for use by ;
  53. ;                           the memory manager.  In this instance it contains ;
  54. ;                           the data for the mapping hardware state.          ;
  55. ;                                                                             ;
  56. ; C USE CONVENTION:   unsigned int   status;                                  ;
  57. ;                     CONTEXT_STRUCT dest_context;                            ;
  58. ;                     CONTEXT_STRUCT source_context;                          ;
  59. ;                                                                             ;
  60. ;                     status = get_set_context (&dest_context,                ;
  61. ;                                               &source_context);             ;
  62. ;-----------------------------------------------------------------------------;
  63. .XLIST
  64. PAGE    60,132
  65.  
  66. IFDEF SMALL
  67.    .MODEL SMALL, C
  68. ENDIF
  69. IFDEF MEDIUM
  70.    .MODEL MEDIUM, C
  71. ENDIF
  72. IFDEF LARGE
  73.    .MODEL LARGE, C
  74. ENDIF
  75. IFDEF COMPACT
  76.    .MODEL COMPACT, C
  77. ENDIF
  78. IFDEF HUGE
  79.    .MODEL HUGE, C
  80. ENDIF
  81.  
  82. INCLUDE emmlib.equ
  83. INCLUDE emmlib.str
  84. INCLUDE emmlib.mac
  85. .LIST
  86. .CODE
  87.  
  88. get_set_context        PROC                                                  \
  89.             USES DS SI DI,                                        \
  90.             ptr_dest_context:FAR PTR BYTE,                            \
  91.             ptr_source_context:FAR PTR BYTE
  92.  
  93.     ;---------------------------------------------------------------------;
  94.     ;   do;                                                               ;
  95.     ;   .   get current & set new memory mapping context from/to EMM;     ;
  96.     ;---------------------------------------------------------------------;
  97.     MOVE        AX, get_and_set_page_map_fcn
  98.     MOVE        ES:DI, ptr_dest_context
  99.     MOVE        DS:SI, ptr_source_context
  100.     INT         EMM_int
  101.  
  102.     ;---------------------------------------------------------------------;
  103.     ;   .   return (EMM status);                                          ;
  104.     ;   end;                                                              ;
  105.     ;---------------------------------------------------------------------;
  106.     RET_EMM_STAT    AH
  107.  
  108. get_set_context        ENDP
  109.  
  110. END
  111.